package com.ysd.lis.controller;


import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.WkQualityDetail;
import com.ysd.lis.request.QualityDetailListParams;
import com.ysd.lis.service.WkQualityDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 质量控制计划明细表 前端控制器
 * </p>
 *
 * @author LiuQi
 * @since 2024-05-08
 */
@RestController
@RequestMapping("/wk/quality/detail")
public class WkQualityDetailController extends BaseController {

    @Autowired
    WkQualityDetailService wkQualityDetailService;

    @GetMapping("/getQualityDetailList")
    public Result getQualityDetailList(QualityDetailListParams QualityDetailListParams) {
        return wkQualityDetailService.getQualityDetailList(QualityDetailListParams);
    }

    @PostMapping("/saveBatchQualityDetail")
    @LogDetail(requestParam = "addQualityDetail", operationType = OperationType.INSERT, module = "质量控制计划明细", content = "增加质量控制明细【fileName】", businessName = "fileName")
    public Result addQualityDetail(@RequestBody List<WkQualityDetail> wkQualityDetails) {
        return wkQualityDetailService.addQualityDetail(wkQualityDetails);
    }

    @PostMapping("/addQualityDetail")
    @LogDetail(requestParam = "addQualityDetail", operationType = OperationType.INSERT, module = "质量控制计划明细", content = "增加质量控制明细【detailTitle】", businessName = "detailTitle")
    public Result addQualityDetail(@RequestBody WkQualityDetail wkQualityDetail) {
        return wkQualityDetailService.addQualityDetail(wkQualityDetail);
    }

    @PostMapping("/editQualityDetail")
    @LogDetail(requestParam = "editQualityDetail", operationType = OperationType.UPDATE, module = "质量控制计划明细", content = "编辑质量控制明细【detailTitle】", businessName = "detailTitle")
    public Result editQualityDetail(@RequestBody WkQualityDetail wkQualityDetail) {
        return wkQualityDetailService.editQualityDetail(wkQualityDetail);
    }

    @PostMapping("/deleteQualityDetail")
    @LogDetail(requestParam = "deleteQualityDetail", operationType = OperationType.DELETE, module = "质量控制计划明细", content = "删除质量控制明细信息")
    public Result deleteQualityDetail(@RequestBody List<String> ids) {
        return wkQualityDetailService.deleteQualityDetail(ids);
    }
}
